<?php



class Model_Hr_Tasklist extends Zend_Db_Table_Abstract {

	protected $_name = 'task_list';

	public function getTasklist( $idTask){

		$row = $this->fetchRow("`id_task` = ". $idTask);
		if(!$row) return false;
		return $row->toArray();

	}

	public function addTasklist( $idStaff , $titleTask , $commentTask , $linkTask , $repeatMonth , $repeatDay , $repeatWeek , $repeatWeekDay , $repeatCycle , $responsier , $createBy,$createDate,$createDay){

		$data = array(
					
				"id_staff" =>  $idStaff ,
				"title_task" =>  $titleTask ,
				"comment_task" =>  $commentTask ,
				"link_task" =>  $linkTask ,
				"repeat_month" =>  $repeatMonth ,
				"repeat_date" =>  $repeatDay ,
				"repeat_week" =>  $repeatWeek ,
				"repeat_week_day" =>  $repeatWeekDay ,
				"repeat_cycle" => $repeatCycle,
				"responsier" =>  $responsier ,
				"create_by" =>  $createBy,
				"create_date" => $createDate,
				"create_day" => $createDay

		);
		$this->insert($data);

	}

	public function updateTasklist(  $idTask ,  $idStaff , $titleTask , $commentTask , $linkTask , $repeatMonth , $repeatDay , $repeatWeek , $repeatWeekDay , $repeatCycle , $responsier , $createBy,$createDate,$createDay){
		$data = array(
					
				"id_staff" =>  $idStaff ,
				"title_task" =>  $titleTask ,
				"comment_task" =>  $commentTask ,
				"link_task" =>  $linkTask ,
				"repeat_month" =>  $repeatMonth ,
				"repeat_day" =>  $repeatDay ,
				"repeat_week" =>  $repeatWeek ,
				"repeat_week_day" =>  $repeatWeekDay ,
				"repeat_cycle" => $repeatCycle,
				"responsier" =>  $responsier ,
				"create_by" =>  $createBy,
				"create_date" => $createDate,
				"create_day" => $createDay

		);
			
		$this->update($data,"`id_task` = ". $idTask);
	}

	public function deleteTasklist( $idTask){

		$this->delete("`id_task` = ". $idTask);

	}

	public function listAll(){

		$rows =$this->fetchAll("1","id_task DESC ");
		if(!$rows) return false;
		return $rows->toArray();

	}
}


?>